home *** CD-ROM | disk | FTP | other *** search
/ Aminet 51 / Aminet 51 (2002)(GTI - Schatztruhe)[!][Oct 2002].iso / Aminet / dev / gg / tcpbug.lha / tcpbug / ip / ip_sourceroute.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-10  |  521 b   |  35 lines

  1. /*
  2.  */
  3.  
  4. #include <netinet/ip.h>
  5.  
  6. #include "ip_misc.h"
  7.  
  8.  
  9. #define Export
  10.  
  11.  
  12. Export    char *
  13. source_route(int       type,
  14.          char    ** hostlist,
  15.          int       nhosts;
  16.          int     * result_len)
  17. {
  18.     char    * option;
  19.  
  20.  
  21.     if (type != IPOPT_LSRR  &&  type != IPOPT_SSRR) {
  22.     errno = EINVAL;
  23.     return NULL;
  24.     }
  25.  
  26.     optlen = nhosts * 4 + IPOPT_MINOFF;
  27.     option = malloc(optlen);
  28.     if (option == NULL)
  29.     return NULL;
  30.     option[0] = type;
  31.     option[1] = optlen;
  32.     option[2] = IPOPT_MINOFF;
  33.     h = &option[IPOPT_MINOFF - 1];
  34.     
  35.